import {getCompanyList,getCategoryList} from '../api'
export const formItems = [
  {
    label: '组件ID',
    name: 'id',
    type: 'input',
    itemProps: {
      disabled: true
    }
  },
  {
    label: '所属栏目页',
    name: 'category_id',
    value: undefined,
    type: 'select',
    required: true,
    asyncOptions: {
      api: getCategoryList,
      dataField: 'list',
      optionFields: {
        label: 'title',
        value: 'id',
      },
    }
  },
  {
    label: '所属企业',
    name: 'company_id',
    type: 'select',
    value: '0',
    hidden: (formState) => {
      return !formState.category_id
    },
    itemProps: {
      disabled: true
    },
    asyncOptions: {
      api: getCompanyList,
      dataField: 'list',
      optionFields: {
        label: 'name',
        value: 'id',
      },
    }
  },  
  {
    label: '组件名称',
    name: 'title',
    value: '',
    type: 'input',
    required: true,
  },
  {
    label: '模块排列顺序',
    name: 'sort',
    type: 'input-number',
    required: true,
  },
  {
    label: '视频',
    name: 'mode',
    value: 'one_line_one',
    slot: 'mode',
  }
];

export const formItems2Rules = {

};
